package personal.learn.test;

import java.util.Scanner;

/**
 * 被3整除的数
 *
 * @author Chai yansheng
 * @create 2019/8/26
 **/
public class Mod3 {
    public static int getCount(int n) {
        if (n == 0) return 0;
        int mod = n % 3;
        if (mod == 1) {
            return (n / 3) * 2;
        } else if (mod == 2) {
            return (n / 3) * 2 + 1;
        } else {
            return (n / 3) * 2;
        }
    }
    public static int fuck(int n) {
        return (n + 2) / 3;
    }
    public static int getResult(int l, int r) {
        return r-l+1-fuck(r)+fuck(l-1);
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int l, r;
        while (in.hasNext()) {
            l = in.nextInt();
            r = in.nextInt();
            int count = getCount(r) - getCount(l - 1);
            int count2 = getResult(l, r);
            System.out.println(count);
        }
    }
}
